import UtilWaitObj from "@/tool/ToolWaitObj";

let startArgs = {
	cameraIndexCode: 'de6c7ce48a0d4683bbdf8f38bcb9a7b6',
	streamMode: 0,
	transMode: 1,
	gpuMode: 0,
	//录像存储类型：0-中心存储，1-设备存储
	recordLocation: 1,
	//可指定播放窗口
	wndId: -1
}

async function generateHkPlayArgument(pubKey) {
	return {
		appkey: "23991440",
		secret: await getEncrypt(pubKey),
		ip: "117.158.156.150",
		playMode: 0, // 预览
		port: 801,
		snapDir: "D:\\SnapDir",
		videoDir: "D:\\VideoDir",
		layout: "1x1",
		enableHTTPS: 0,
		encryptedFields: "secret",
		showToolbar: 1, //是否显示工具栏，0-不显示，非0-显示
		showSmart: 1, //是否显示智能信息（如配置移动侦测后画面上的线框），0-不显示，非0-显示
		buttonIDs: "0,16,256,257,258,259,260,512,513,514,515,516,517,768,769", //自定义工具条按钮
	}
}

// rtsp://23991440:G9MvIH2NnYQ4hLJ1eG6p@117.158.156.164:801/Streaming/Channels/0

async function getEncrypt(pubKey) {
	let JSEncrypt = await UtilWaitObj.waitObj('JSEncrypt')
	var encrypt = new JSEncrypt();
	encrypt.setPublicKey(pubKey)
	return encrypt.encrypt('G9MvIH2NnYQ4hLJ1eG6p');
}

export default {
	generateHkPlayArgument,
	getEncrypt,
	startArgs
}
